{extend name="admin/b2c/base" /}
{block name="resources"/}
<script type="text/javascript" src="__STATIC__/My97DatePicker/WdatePicker.js"></script>
<style  type="text/css">

.set-style{
	width:100%;
}
.set-style dl{
	width:100%;
	font-size: 0;
	/* line-height: 20px; */
	clear: both;
	padding: 0;
	margin: 0;
	border-bottom: dotted 1px #E6E6E6;
	overflow: hidden;
}
.set-style dl dt{
	font-size: 12px;
	line-height: 32px;
	vertical-align: top;
	letter-spacing: normal;
	word-spacing: normal;
	text-align: right;
	display: inline-block;
	width: 19%;
	padding: 10px 1% 10px 0;
	margin: 0;
	font-weight:normal;
}
.set-style dl dd{
	
	font-size: 12px;
	line-height: 32px;
	vertical-align: top;
	letter-spacing: normal;
	word-spacing: normal;
	display: inline-block;
	width: 78%;
	padding: 10px 0 10px 0;
}
.set-style dl dd input[type="text"]{
	font: 12px/20px Arial;
	color: #777;
	background-color: #FFF;
	vertical-align: top;
	display: inline-block;
	height:24px;
	line-height:24px;
	padding: 4px;
	border: 1px solid #CCC;
	outline: 0 none;
	width: 400px;
	margin:0;
}
.set-style dl dd textarea{
    font: 12px/20px Arial;
    color: #777;
    background-color: #FFF;
    vertical-align: top;
    display: inline-block;
    height: 60px;
    padding: 4px;
    border: solid 1px #CCC;
    outline: 0 none;
	width: 400px;
	margin:0;
}
.hint{
    font-size: 12px;
    line-height: 16px;
    color: #BBB;
    margin-top: 10px;
}
.set-style dl dd p img{
	border: medium none;
	vertical-align: middle;
}
.class-logo{
	background-color: #FFF;
	position: relative;
	z-index: 1;
}
.class-logo p{
	width: 200px;
	height: 60px;
	line-height: 0;
	background-color: #FFF;
	text-align: center;
	vertical-align: middle;
	display: table-cell;
	*display: block;
	overflow: hidden;
	    margin: 0 0 10px;
		border: dashed 1px #E6E6E6;
}
.class-logo p img{
	max-width: 200px;
	max-height: 60px;
	border: medium none;
	vertical-align: middle;
	margin-top: expression(60-this.height/2);
	*margin-top: expression(30-this.height/2);
}
.edit_button{
	padding-top:10px;
	padding-bottom:10px;
	padding-left:30px;
	padding-right:30px;
	background-color:#51A351;
	color:#FFF;
	margin:20px auto;
	border:none;
	display:block;
}
.error{
	font-size: 12px;
    line-height: 16px;
    color: red;
    margin-top: 10px;
	display:none;
}
.set-style dl dd p{
	margin-bottom:0;
}

/*独立*/
.status-error{
	display:inline-block;
	padding-left:5px;
	padding-right:5px;	
	padding-bottom:3px;
	padding-top:3px;
	color:#FFF;
	background-color:#de533c;
}
/*独立*/
.status-success{
	display:inline-block;
	color:#FFF;
	padding-left:5px;
	padding-right:5px;	
	padding-bottom:3px;
	padding-top:3px;
	background-color:#5be15b;
}

</style>

 {/block}
{block name="right_tab"}
 
{/block}
{block name="main"}

<div class="set-style">
	<dl>
		<dt>广告名称:</dt>
		<dd>
			<p><input name="UserCode" id="adv_title" type="text" value="{$adv_info['adv_title']}"> </p>
			<p class="error">请输入广告名称</p>
		</dd>
	</dl>
	<dl>
		<dt>广告图片:</dt>
		<dd>
			<div class="class-logo"><p><img id="imgLogo" src="__UPLOAD__/{$adv_info['adv_image']}" ></p></div>
			<div class="ncsc-upload-btn"> 
			    <a href="javascript:void(0);"><span>
			          <input hidefocus="true" size="1" class="input-file" name="file_upload" id="uploadImg" nc_type="change_store_label" type="file" onchange="imgUpload(this);">
			        <input type="hidden"id="Logo"value=""/></span><p><i class="icon-upload-alt"></i>上传图片</p>
			    </a> 
			</div>
		</dd>
	</dl>
	<dl>
		<dt>背景色:</dt>
		<dd>
			<div class="ncsc-upload-btn"> 
			    <a href="javascript:void(0);">
			          <input id="background" type="color" style="width:60px;height:25px;"  value="{$adv_info['background']}"/>
			    </a>  
			</div>
		</dd>
	</dl>
	<dl>
		<dt>链接地址:</dt>
		<dd>
			<p><input name="UserCode" id="adv_url" type="text" value="{$adv_info['adv_url']}"> </p>
			<p class="error">请输入链接地址</p>
		</dd>
	</dl>
	<dl>
		<dt>排序:</dt>
		<dd>
			<p><input name="UserCode" id="slide_sort" type="text" value="{$adv_info['slide_sort']}"> </p>
			<p class="error">请输入序号</p>
		</dd>
	</dl>
	<input type="hidden" id="adv_id" value="{$adv_info['adv_id']}">
	<input type="hidden" id="ap_id" value="{$adv_info['ap_id']}">
	<button class="edit_button" onclick="updateShopAdvAjax();">保存</button>
</div>	

{/block}
{block name="script"}
{include file="admin/b2c/openDialog" /}
<script src="ADMIN_JS/ajax_file_upload.js" type="text/javascript"></script>
<script src="__STATIC__/js/file_upload.js" type="text/javascript"></script>
<script>
function imgUpload(event) {
	var fileid = $(event).attr("id");	
	fileCommonUpload("UPLOAD_URL", fileid, "__UPLOAD__");
}
/**
*添加广告位
*/
function updateShopAdvAjax() {
	var adv_id = $("#adv_id").val();
	var adv_title = $("#adv_title").val();
	var ap_id = $("#ap_id").val();
	if($("#Logo").val().length > 0){
		var adv_image = $("#Logo").val();
	}else{
		var adv_image = "{$adv_info['adv_image']}"; 
	}
	var adv_url = $("#adv_url").val();
	var slide_sort = $("#slide_sort").val();
	var background = $("#background").val();
//		verify(ad_image, link_url);
	$.ajax({
		type : "post",
		url : "ADMIN_MAIN/System/updateShopAdv",
		data : {
			'adv_id' : adv_id,
			'adv_title' : adv_title,
			'ap_id' : ap_id,
			'adv_image' : adv_image,
			'adv_url' : adv_url,
			'slide_sort' : slide_sort,
			'background' : background
		},
		async : true,
		success : function(data) {
			if (data["code"] > 0) {
				showMessage('success', "修改成功",'ADMIN_MAIN/System/shopAdvList?ap_id='+ap_id);
			}else{
				showMessage('error', "修改失败");
			}
		}
	});
}

</script>
{/block}